package com.baseDemo.web.service.authority.impl;

import java.util.List;
import java.util.Set;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.baseDemo.web.dao.authority.AuthorityEntityDao;
import com.baseDemo.web.entity.AuthorityEntity;
import com.baseDemo.web.service.authority.AuthorityService;
import com.share.service.baseServiceSupport.impl.BaseServiceSupport;
@Service
public class AuthorityServiceImpl extends BaseServiceSupport<AuthorityEntity> implements AuthorityService{

	@Resource AuthorityEntityDao authorityEntityDao;
	@Override
	public List<AuthorityEntity> getAuthorityByNavigation(
			String navigationid) {
		if(!"".equals(navigationid)){
			return authorityEntityDao.getAuthorityByNavigation(navigationid);
		}
		return null;
	}
	@Override
	public String destroyAuthority(Set<AuthorityEntity> authorities) {
		if(authorities!=null&&authorities.size()>0){
			for (AuthorityEntity authorityEntity : authorities) {
				authorityEntityDao.delete(authorityEntity);
			}
			return String.valueOf(1);
		}
		return String.valueOf(0);
	}
	@Override
	public String updateAuthority(AuthorityEntity authorityEntity) {
		return authorityEntityDao.updateAuthority(authorityEntity);
	}

}
